package com.ljm.mp.util;

import com.alibaba.fastjson.JSONObject;
import com.ljm.mp.constant.MpUrlConstant;
import com.ljm.mp.dto.AccessTokenDto;
import com.ljm.mp.http.HttpUtil;

import java.text.MessageFormat;

public class AccessUtil {
    private AccessUtil(){}
    public static AccessTokenDto getAccessToken(String appId,String secret){
        String jsonStr=HttpUtil.httpGet(MessageFormat.format(MpUrlConstant.ACCESS_TOKEN_URL,appId,secret));
        return JSONObject.parseObject(jsonStr, AccessTokenDto.class);
    }
}
